import { Component, OnInit } from '@angular/core';
import { Carousel } from '../../model/carousel';
import { CarouselService } from '../../service/carousel.service';

@Component({
  selector: 'app-forshow',
  templateUrl: './forshow.component.html',
  styleUrls: ['./forshow.component.css']
})
export class ForshowComponent implements OnInit {

  // images:Array<string>;
  cl:Array<Carousel>;

  constructor(
    private carouselservice:CarouselService
  ) {
    this.cl=new Array();
    // for(let i=0;i<=3;i++){
    //   let c=new Carousel();
    //   c.carouselid="id"+i;
    //   c.content="content"+i;
    //   c.title="title"+i;
    //   c.discription="discription"+i;
    //   c.pic="http://cms-bucket.nosdn.127.net/2018/12/10/15a1ce1d059b4d1ab717781a644080e5.jpeg?imageView&thumbnail=550x0";
    //   this.cl.push(c);
    // }
   }

  ngOnInit() {
  //   this.images=new Array();
  //   this.images.push('http://p2.so.qhimgs1.com/bdr/_240_/t01572332418de97212.jpg');
  //   this.images.push('http://p1.so.qhimgs1.com/bdr/_240_/t01527e1902ad2ef72d.jpg');
  //   this.images.push('http://p2.so.qhimgs1.com/bdr/_240_/t01566ffc8d04745ffe.jpg');
  //   this.images = [1, 2, 3].map(() => `https://picsum.photos/900/500?random&t=${Math.random()}`);


  this.cl=new Array();
   this.carouselservice.getCarouselList()
   .then((data:any)=>{
     this.cl=data;
     console.log(this.cl[0].pic);

   })

  }

}
